<template>
	<div class="w1024-wrap">
		<div class="page">
			<div class="head" style="margin-bottom: 10px;">
				<div class="search-wrap">
					<div class="clear">
						<div class="form-item left">
							<p class="form-item-title">客户姓名：</p>
							<div class="form-item-content">
								<el-input clearable v-model="searchData.customername" placeholder="请输入客户姓名"></el-input>
							</div>
						</div>
						<div class="form-item left">
							<p class="form-item-title">集团名称：</p>
							<div class="form-item-content">
								<el-input clearable v-model="searchData.companyname" placeholder="请输入集团名称"></el-input>
							</div>
						</div>
						<div class="form-item left">
							<p class="form-item-title">联系电话：</p>
							<div class="form-item-content">
								<el-input clearable v-model="searchData.linkphone" placeholder="请输入联系电话"></el-input>
							</div>
						</div>
					</div>
					<div class="clear">
						<div class="form-item left" v-if="level<3">
							<p class="form-item-title">{{level==1?'所属渠道':'所属人'}}：</p>
							<div class="form-item-content" style="width: 120px;">
								<el-select @change="search" clearable v-model="searchData.ownername" placeholder="请选择">
									<el-option v-for="item in channelList" :key="item.channelid" :label="item.channelname" :value="item.channelname"></el-option>
								</el-select>
							</div>
						</div>
						<div class="form-item left">
							<p class="form-item-title">跟进状态：</p>
							<div class="form-item-content" style="width: 120px;">
								<el-select @change="search" clearable v-model="searchData.followstatus" placeholder="请选择">
									<el-option key="1" label="未跟进" value="1"></el-option>
									<el-option key="2" label="跟进中" value="2"></el-option>
									<el-option key="3" label="已放弃" value="3"></el-option>
									<el-option key="4" label="已成交" value="4"></el-option>
									<el-option key="5" label="系统回收" value="5"></el-option>
								</el-select>
							</div>
						</div>
					</div>
					<div class="clear">
						<div class="form-item left">
							<p class="form-item-title">跟进时间：</p>
							<div class="form-item-content" style="width: 230px;">
								<el-date-picker clearable style="width:230px;" v-model="value1" value-format="yyyy-MM-dd" type="daterange" @change="dealTimeChange" start-placeholder="开始日期" end-placeholder="结束日期" placeholder="选择日期">
								</el-date-picker>
							</div>
						</div>
						<div class="form-item left">
							<el-button class="left" type="primary" @click="search">查询</el-button>
							<el-button class="left" type="default" @click="reset">重置</el-button>
						</div>
						<div class="form-item right" style="margin-right: 0;">
							<el-button class="add-btn" type="primary left" @click="add"><i class="el-icon-plus"></i>新建</el-button>
							<el-button v-if="userRole==0&&level>1" class="distribute-btn" type="primary left" @click="batchDistribute"><img src="../../assets/images/crm/distribute_icon.svg" />分配</el-button>
							<el-button class="import-btn" type="primary left" @click="importMaterial"><img src="../../assets/images/crm/import.svg" />导入</el-button>
						</div>
					</div>
				</div>
			</div>
			<template v-if="list.length">
				<div class="table-wrap">
					<el-table ref="table" :row-class-name="rowClassFunc" v-loading="loading" size="middle" :data="list" style="width: 100%">
						<el-table-column fixed type="selection" width="36"></el-table-column>
						<el-table-column label="客户姓名" min-width="96">
							<template slot-scope="scope">
								<span style="position: relative;">{{scope.row.customername||'-'}}
									<img class="resubmit" src="../../assets/images/crm/repeat.svg" v-if="scope.row.resubmit==1"/>
								</span>
							</template>
						</el-table-column>
						<el-table-column prop="linkphone" label="联系电话" min-width="100"></el-table-column>
						<el-table-column prop="phonearea" label="号码归属地" min-width="90">
							<template slot-scope="scope">
								<span>{{scope.row.phonearea||'-'}}</span>
							</template>
						</el-table-column>
						<el-table-column label="集团名称" min-width="100">
							<template slot-scope="scope">
								<span>{{scope.row.companyname||'-'}}</span>
							</template>
						</el-table-column>
						<el-table-column  label="来源" width="76">
							<template slot-scope="scope">
								<span>{{(scope.row.selfbuild==1&&scope.row.isimport==2)?'手动创建':!scope.row.source?(scope.row.sourcedesc||'-'):scope.row.source==1?'抖音':scope.row.source==2?'快手':scope.row.source==3?'头条':scope.row.source==13?'自建库-抖音':scope.row.source==14?'自建库-头条':scope.row.source==15?'自建库-快手':'-'}}</span>
							</template>
						</el-table-column>
						<el-table-column :label="level==1?'所属渠道':'所属人'" min-width="76">
							<template slot-scope="scope">
								<span v-if="level==1">{{scope.row.channelname||'待分配'}}</span>
								<span v-else>{{scope.row.ownername||'待分配'}}</span>
							</template>
						</el-table-column>
						<el-table-column prop="followstatus" label="跟进状态" min-width="70">
							<template slot-scope="scope">
								<span v-if="scope.row.followstatus==1">未跟进</span>
								<span v-else-if="scope.row.followstatus==2">跟进中</span>
								<span v-else-if="scope.row.followstatus==3">已放弃</span>
								<span v-else-if="scope.row.followstatus==4">已成交</span>
								<span v-else-if="scope.row.followstatus==5">系统回收</span>
								<span v-else>未跟进</span>
							</template>
						</el-table-column>
						<el-table-column label="最近跟进记录" min-width="120">
							<template slot-scope="scope">
								<template v-if="scope.row.latestmemo">
									<el-popover v-if="scope.row.latestmemo.length>9" placement="top-start" width="300" trigger="hover" :content="scope.row.latestmemo">
										{{scope.row.latestmemo}}
										<p class="text-overflow-hidden" slot="reference">{{scope.row.latestmemo}}</p>
									</el-popover>
									<span v-else>{{scope.row.latestmemo||'-'}}</span>
								</template>
								<span v-else>-</span>
							</template>
						</el-table-column>
						<el-table-column prop="follownum" label="跟进次数" min-width="70">
							<template slot-scope="scope">
								<span>{{scope.row.follownum}}次</span>
							</template>
						</el-table-column>
						<el-table-column prop="createtime" label="创建时间" width="88"></el-table-column>
						<el-table-column label="最近跟进时间" width="100">
							<template slot-scope="scope">
								<span>{{scope.row.latest||'-'}}</span>
							</template>
						</el-table-column>
						
						<el-table-column label="留电时间" width="88">
							<template slot-scope="scope">
								<span>{{scope.row.leavetime||'-'}}</span>
							</template>
						</el-table-column>
						<el-table-column width="160" fixed="right" label="操作">
							<div slot-scope="scope" class="btn-inner clear">
								<router-link :to="'/crm/materialdetail/'+scope.row.customeruid" class="btn" title="详情">
									<img src="../../assets/images/crm/detail.svg" />
								</router-link>
								<div v-if="scope.row.currentuserid==user.buyerid" class="btn" title="编辑" @click="edit(scope.row)">
									<img src="../../assets/images/crm/edit.svg" />
								</div>
								<div class="btn" v-if="userRole==0&&level>1" title="分配" @click="distribute(scope.row)">
									<img src="../../assets/images/crm/distribute.svg" />
								</div>
								<el-popconfirm v-if="scope.row.currentuserid==user.buyerid" confirm-button-text='确定' cancel-button-text='取消' icon="el-icon-info" icon-color="orange" @confirm="changeToCustomer(scope.row.customeruid)" title="确定要将当前客户线索转为客户吗？">
									<span slot="reference" style="background: rgb(251,193,85);" class="btn pay-btn" title="转客户">转</span>
								</el-popconfirm>
								<span v-if="scope.row.currentuserid==user.buyerid&&scope.row.followstatus!=3&&(scope.row.assignstatus!=1||scope.row.selfbuild==1)" style="background: rgb(84,181,66);" class="btn pay-btn" @click="deal(scope.row)" title="跟进">跟</span>
								<el-popconfirm v-if="level>1&&scope.row.currentuserid!=user.buyerid" confirm-button-text='确定' cancel-button-text='取消' icon="el-icon-info" icon-color="orange" @confirm="get(scope.row.customeruid)" title="确定要领取当前客户线索吗？">
									<span slot="reference" style="background: #A981D8;" class="btn pay-btn" title="领取">领</span>
								</el-popconfirm>
								<el-popconfirm v-if="level>1&&scope.row.selfbuild!=1&&scope.row.currentuserid==user.buyerid&&scope.row.followstatus!=4" confirm-button-text='确定' cancel-button-text='取消' icon="el-icon-info" icon-color="orange" @confirm="giveUp(scope.row.customeruid)" title="确定放弃取当前客户线索吗">
									<span slot="reference" style="background: #8F8DB1;" class="btn pay-btn" title="放弃">弃</span>
								</el-popconfirm>
							</div>
						</el-table-column>
					</el-table>
				</div>
				<el-pagination :current-page="this.searchData.pagenow" class="text-center" layout="prev, pager, next,sizes" prev-text="上一页" next-text="下一页" @size-change="pageSizeChange" @current-change="currentPageChange" :total="totalCount">
				</el-pagination>
			</template>
			<no-data v-if="!loading&&!list.length"></no-data>
		</div>
		<add-or-edit-customer :customerData="obj" :type="1" :show="editVisible" @closeEditCustomer="editVisible=false" @updateSuccess="getData"></add-or-edit-customer>
		<el-dialog :title="batchFlag?'批量分配':'分配'" top="30vh" :visible.sync="distributeVisible" width="360px" center>
			<div class="dialog-content clear" style="padding: 30px 10px;">
				<div class="form-item" >
					<p class="form-item-title">所属渠道：</p>
					<div class="form-item-content" style="max-height: 200px;overflow: auto;">
						<el-tree
						  :props="props"
						  node-key="channelid"
						  :data="channelList"
						  ref="treeList"
						  show-checkbox
						  check-strictly
						  @check-change="handleCheckChange">
						  </el-tree>
						<!--<el-select @change="channelChange" clearable v-model="channelIndex" placeholder="请选择">
							<el-option v-for="(item,index) in channelList" :key="item.channelid" :label="item.channelname" :value="index"></el-option>
						</el-select>-->
					</div>
				</div>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" plain @click="distributeVisible=false">取 消</el-button>
			    <el-button v-if="!batchFlag" type="primary" @click="confirmDistribute">确 认</el-button>
			    <el-button v-else type="primary" @click="confirmBatchDistribute">确 认</el-button>
			</span>
		</el-dialog>
		
		<el-dialog title="导入" top="30vh" :visible.sync="importVisible" @close="closeUpload" width="420px" center>
			<div class="dialog-content clear" style="padding: 30px 10px;">
				<div class="form-item" >
					<p class="form-item-title">选择文件：</p>
					<div class="form-item-content" style="width: auto;">
						<div class="clear">
							<el-upload :limit="1" style="width:200px;" ref="upload" :auto-upload="false" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" :action="baseUrl+'/api/product/crm/customer/uploadfile'" :http-request="upload" class="upload-demo left" :before-upload="beforeUpload" :on-success="uploadSuccess" :on-error="uploadError">
								<el-button size="small" type="primary"><i class="el-icon-upload"></i>点击选择</el-button>
							</el-upload>
							<a href="https://img.xnhkfpt.com/lvdata/CRM_TEMPLATE.xls" class="left template-download">模板下载</a>
						</div>
						
						<div class="red" style="line-height: 18px;margin-top: 4px;width: 256px;" v-html="tipText"></div>
					</div>
				</div>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" plain @click="closeUpload">取 消</el-button>
			    <el-button type="primary" @click="confirmImport">确定上传</el-button>
			</span>
		</el-dialog>
		
		<el-dialog title="跟进" top="15vh" :visible.sync="dealVisible" width="600px" center>
			<div class="dialog-content">
				<div class="clear">
					<div class="form-item">
						<p class="form-item-title">跟进方式：</p>
						<div class="form-item-content">
							<el-radio-group size="small" v-model="dealObj.followway">
								<el-radio-button label="1">微信</el-radio-button>
								<el-radio-button label="2">手机</el-radio-button>
							</el-radio-group>
						</div>
					</div>
				</div>
				<div class="clear" v-if="dealObj.followway==2">
					<div class="form-item">
						<p class="form-item-title">跟进标识：</p>
						<div class="form-item-content" style="width: 300px;">
							<p class="invalid-item" :class="dealObj.tag==4?'selected-invalid':''" @click="dealObj.tag=4">认可价格和产品,同意加微信</p>
							<p class="invalid-item" :class="dealObj.tag==5?'selected-invalid':''" @click="dealObj.tag=5">有彩铃需求，不排斥加微信</p>
							<p class="invalid-item" :class="dealObj.tag==6?'selected-invalid':''" @click="dealObj.tag=6">有彩铃需求,一听价格就挂电话</p>
						</div>
					</div>
				</div>
				<div class="clear">
					<div class="form-item">
						<p class="form-item-title">是否有效：</p>
						<div class="form-item-content" style="width: 430px;">
							<p>
								<el-radio v-model="dealObj.isvalid" :label="1">有效</el-radio>
  								<el-radio v-model="dealObj.isvalid" :disabled="invalidnum>0" :label="2">无效</el-radio>
							</p>
							<div class="clear" v-if="dealObj.isvalid==2" style="margin-top: 8px;">
								<p class="invalid-item" v-for="item in unvalidDescList" :class="dealObj.isvaliddesc==item?'selected-invalid':''" @click="dealObj.isvaliddesc=item">{{item}}</p>
							</div>
						</div>
					</div>
				</div>
				<div class="clear">
					<div class="form-item">
						<p class="form-item-title" style="width: 128px;">下次跟进时间：</p>
						<div class="form-item-content">
							<el-date-picker clearable style="width:230px;" v-model="dealObj.nextfollowtime" value-format="yyyy-MM-dd hh:mm" format="yyyy-MM-dd hh:mm" type="datetime" placeholder="请选择">
								</el-date-picker>
						</div>
					</div>
				</div>
				<div class="clear">
					<div class="form-item">
						<p class="form-item-title">跟进备注：</p>
						<div class="form-item-content">
							<el-input size="small" rows="4" resize="none" type="textarea" style="width:330px;" maxlength="500" v-model="dealObj.note"placeholder="请输入(最多输入500个字符)"></el-input>
						</div>
					</div>
				</div>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button type="primary" plain @click="dealVisible=false">取 消</el-button>
			    <el-button type="primary" @click="confirmDeal">确 认</el-button>
			</span>
		</el-dialog>
		<input type="hidden" name="" id="" :value="user" />
		<view-img :src="imgSrc" v-if="showImg" @close="closeImg"></view-img>
	</div>
</template>

<script>
	import NoData from '@/components/NoData'
	import AddOrEditCustomer from '@/components/AddOrEditCustomer'
	import { phoneReg, deepClone,baseUrl,setCookie,getCookie} from '@/utils/common'
	export default {
		name: 'Metarial',
		components: {
			NoData,
			AddOrEditCustomer,
		},
		data() {
			return {
				baseUrl,
				level:'',
				userRole:'',
				value1: '',
				loading: false,
				network: false,
				totalCount: 0,
				editVisible:false,
				distributeVisible:false,
				dealVisible:false,
				importVisible:false,
				tipText:'',
				channelList:[],
				props:{
					label:'channelname'
				},
				searchData: {
					shownum: 10,
					pagenow: getCookie('page')?Number(getCookie('page')):1,
					category:1,
					customerlevel:'',
					companyname:'',
					customername:'',
					linkphone:'',
					followstatus:'',
					ownername:'',
					tradename:'',
					freetimestart:'',
					freetimeend:'',
					resourcetype:'',
					casetype:'',
					starttime: '',
					endtime: '',
				},
				list: [],
				obj:{},
				invalidnum:0,
				unvalidDescList:['点错，号码错误，手机号码空号','电话跟进2天6通无人接听','加了微信后一说企业彩铃就秒删，电话跟进后反馈错误， 或者2天6通电话无人接听'],
				batchFlag:false,
				channelids:'',
				channelnames:'',
				customeruids:'',
				dealObj:{},
			}
		},
		beforeRouteLeave(to,from,next){
			if(to.name=='MaterialDetail'){
				setCookie('page',this.searchData.pagenow,1)
				sessionStorage.setItem('searchData',JSON.stringify({
					type:'material',
					data:this.searchData
				}))
			}
			next()
		},
		watch:{
			'dealObj.followway':function(val){
				if(val==2){
					this.dealObj.tag=4
				}else{
					this.dealObj.tag=''
				}
			}
		},
		computed:{
			user(){
				if(this.$store.state.user){
					this.level=this.$store.state.user.crmLevel
					this.userRole=this.$store.state.user.userRole
				}
				return this.$store.state.user
			}
		},
		mounted() {
			setCookie('page',0,-1)
			if(sessionStorage.getItem('searchData')){
				var data=JSON.parse(sessionStorage.getItem('searchData'))
				if(data.type=='material'){
					Object.assign(this.searchData,data.data)
					this.value1=this.searchData.starttime&&this.searchData.endtime?[this.searchData.starttime,this.searchData.endtime]:''
				}
				sessionStorage.removeItem('searchData')
			}
			this.getData()
			this.queryChannelList()
		},
		methods: {
			handleCheckChange(data, checked, tree) {
		      if (checked) {
		        this.channelId = data.channelid
		        this.$refs.treeList.setCheckedKeys([data.channelid])
		        if(data.path){
		        	var ids=[],names=[]
		        	var obj
		        	for(var i=0;i<data.path.length;i++){
		        		if(!obj){
		        			obj=this.channelList[data.path[i]]
		        		}
		        		else{
		        			obj=obj.children[data.path[i]]
		        		}
		        		ids.push(obj.channelid)
		        		names.push(obj.channelname)
		        	}
		        	ids.push(data.channelid)
		        	names.push(data.channelname)
		        	this.channelids=ids.join(',')
		        	this.channelnames=names.join(',')
		        }else{
		        	this.channelids=data.channelid
		        	this.channelnames=data.channelname
		        }
		      }
		   	},
			rowClassFunc({row, rowIndex}){
				return row.remind==1?'row-red':''
			},
			dealTimeChange(val) {
				if(val) {
					this.searchData.starttime = val[0]
					this.searchData.endtime = val[1]
				} else {
					this.searchData.starttime = ''
					this.searchData.endtime = ''
				}
			},
			pageSizeChange(pageSize) {
				this.searchData.shownum = pageSize
				this.getData()
			},
			currentPageChange(page) {
				this.searchData.pagenow = page
				this.getData()
			},
			queryChannelList(){
				this.$request.queryChannelList()
				.then(res=>{
					if(res.code==0){
						var list=res.list||[]
						function addParent(list,parentPath){
							for(var i=0;i<list.length;i++){
								list[i].path=parentPath
								var path=deepClone(list[i].path)
								path.push(i)
								if(list[i].children){
									addParent(list[i].children,path)
								}
							}
						}
						list.forEach((item,index)=>{
							if(item.children){
								addParent(item.children,[index])
							}
						})
						this.channelList=list
					}
				})
			},
			search() {
				this.searchData.pagenow = 1
				this.getData()
			},
			reset() {
				this.searchData = {
					shownum: 10,
					pagenow: 1,
					category:1,
					customerlevel:'',
					companyname:'',
					customername:'',
					linkphone:'',
					followstatus:'',
					ownername:'',
					tradename:'',
					freetimestart:'',
					freetimeend:'',
					resourcetype:'',
					casetype:'',
					starttime: '',
					endtime: '',
				}
				this.value1=''
				this.getData()
			},
			getData() {
				this.loading = true
				this.$request.queryCustomerList(this.searchData)
					.then(res => {
						if(res.code == 0) {
							this.list = res.list
							this.totalCount = res.page.totalresult
						} else {
							this.msgError(res.msg)
						}
						this.loading = false
					})
			},
			add() {
				this.obj={}
				this.editVisible=true
			},
			batchDistribute() {
				this.batchFlag = true
				var list = this.$refs.table.selection
				if(!list.length) {
					this.msgError('请先选择数据')
					return
				}
				var flag = true
				var ids = []
				list.forEach(item => {
//					if(item.owenerid) {
//						flag = false
//					}
					ids.push(item.customeruid)
				})
//				if(!flag) {
//					this.msgError('已分配渠道的客户不可再分配')
//					return
//				}
				this.customeruids = ids.join(',')
				this.channelids = ''
				this.channelnames=''
				this.distributeVisible = true
				this.$nextTick(()=>{
					this.$refs.treeList.setCheckedKeys([])
				})
			},
			confirmBatchDistribute(){
				if(this.network) {
					return
				}
				if(!this.channelids||!this.channelnames){
					this.msgError('请选择所属渠道')
					return
				}
				this.network=true
				this.$request.batchDistributeMaterial({
					channelids:this.channelids,
					channelnames:this.channelnames,
					customeruids:this.customeruids
				}).then(res => {
					if(res.code == 0) {
						this.distributeVisible = false
						this.msgSuccess('操作成功')
						this.getData()
					} else {
						this.msgError(res.msg)
					}
					this.network = false
				})
			},
			importMaterial() {
				this.tipText=''
				this.importVisible=true
			},
			confirmImport(){
				this.$refs.upload.submit()
			},
			closeUpload(){
				this.importVisible=false
				this.$refs.upload.clearFiles()
			},
			async upload(param){
				var formData=new FormData()
				formData.append('file',param.file)
				var res=await this.$request.importExcel(formData,{category:1})
				param.onSuccess(res)
			},
			beforeUpload(){
				this.tipText='上传中...'
			},
			uploadError(){
				this.tipText='上传失败'
			},
			uploadSuccess(res, file, fileList){
				if(!res){
					return
				}
				if(res.code==0){
					this.tipText=''
					this.msgSuccess('上传成功')
					this.getData()
					this.closeUpload()
				}else{
					console.log(res)
					this.tipText=res.msg
				}
			},
			edit(obj) {
				this.obj=obj
				this.editVisible=true
			},
			distribute(obj) {
				this.batchFlag = false
				this.customeruids = obj.customeruid
				this.channelids=obj.owenerid
				this.channelnames=obj.ownername
				this.distributeVisible = true
				this.$nextTick(()=>{
					this.$refs.treeList.setCheckedKeys([this.channelids])
				})
			},
			channelChange(){
				if(this.channelIndex||this.channelIndex===0){
					this.distributeObj.channelname=this.channelList[this.channelIndex].channelname
					this.distributeObj.channelid=this.channelList[this.channelIndex].channelid
				}
			},
			confirmDistribute(){
				if(this.network) {
					return
				}
				console.log(this.channelids,this.channelnames)
				if(!this.channelids||!this.channelnames){
					this.msgError('请选择所属渠道')
					return
				}
				this.network = true
				this.$request.distributeMaterial({
					channelids:this.channelids,
					channelnames:this.channelnames,
					customeruid:this.customeruids
				}).then(res => {
					if(res.code == 0) {
						this.distributeVisible = false
						this.msgSuccess('操作成功')
						this.getData()
					} else {
						this.msgError(res.msg)
					}
					this.network = false
				})
			},
			changeToCustomer(customeruid) {
				if(this.network){
					return
				}
				console.log(customeruid)
				this.network=true
				this.$request.transferCustomer({
					customeruid:customeruid
				}).then(res=>{
					if(res.code==0){
						this.msgSuccess('操作成功')
						this.getData()
					}else{
						this.msgError(res.msg)
					}
					this.network=false
				})
			},
			deal(obj) {
				this.invalidnum=obj.invalidnum
				this.dealObj={
					customeruid:obj.customeruid,
					followstatus:2,
					followway:1,
					tag:'',
					isvalid:obj.isvalid,
					isvaliddesc:'',
					nextfollowtime:'',
					hasfile:2,
//					fileurl:'',
//					filename:'',
					note:'',
				}
				this.dealVisible=true
			},
			confirmDeal(){
				if(this.network){
					return
				}
				if(this.dealObj.isvalid==2&&!this.dealObj.isvaliddesc){
					this.msgError('请选择无效原因')
					return
				}
				console.log(this.dealObj)
				this.network=true
				this.$request.saveDeal(this.dealObj)
				.then(res=>{
					if(res.code==0){
						this.msgSuccess('操作成功')
						this.dealVisible=false
						this.getData()
					}else{
						this.msgError(res.msg)
					}
					this.network=false
				})
			},
			get(customeruid){
				if(this.network){
					return
				}
				console.log(customeruid)
				this.network=true
				this.$request.getMaterial({
					customeruid:customeruid
				}).then(res=>{
					if(res.code==0){
						this.msgSuccess('操作成功')
						this.getData()
					}else{
						this.msgError(res.msg)
					}
					this.network=false
				})
			},
			giveUp(customeruid){
				if(this.network){
					return
				}
				console.log(customeruid)
				this.network=true
				this.$request.giveUpClue({
					customeruid:customeruid
				}).then(res=>{
					if(res.code==0){
						this.msgSuccess('操作成功')
						this.getData()
					}else{
						this.msgError(res.msg)
					}
					this.network=false
				})
			},
		}
	}
</script>
<style scoped lang="scss">
	.page {
		.head {
			border-bottom: 10px solid #f5f5f5;
			padding: 0 20px;
		}
		.search-wrap {
			padding: 24px 10px 8px;
			.el-button {
				img,
				i {
					margin-right: 3px;
				}
				i {
					font-size: 12px;
					font-weight: bold;
				}
			}
		}
		>>>.el-table {
			.row-red{
				background: #F56C6C;
			}
			th {
				>.cell {
					padding-left: 6px;
					padding-right: 6px;
					text-align: center;
				}
			}
			td {
				>.cell {
					padding-left: 4px;
					padding-right: 4px;
					text-align: center;
					font-size: 12px;
					line-height: 16px;
					overflow: visible;
					.resubmit{
						width: 20px;
						height: 16px;
						position: absolute;
						left: 0;
						right: 0;
						top: -16px;
						margin: 0 auto;
					}
				}
			}
		}
	}
	
	.btn-inner {
		margin-top: -8px;
		margin-left: -8px;
		.btn {
			width: 24px;
			height: 24px;
			margin-left: 8px;
			margin-top: 8px;
			text-align: center;
			line-height: 24px;
			color: #fff;
			font-weight: bold;
			font-size: 14px;
			cursor: pointer;
			float: left;
			border-radius: 2px;
			position: relative;
			img {
				width: 100%;
				height: 100%;
			}
		}
	}
	
	>>>.el-dialog__header {
		padding: 16px 20px 16px 30px;
		text-align: left;
		font-weight: bold;
	}
	
	>>>.el-dialog--center .el-dialog__body {
		padding: 0 16px 10px;
		.dialog-content {
			border-top: 1px solid #eee;
			border-bottom: 1px solid #eee;
			padding: 20px 10px;
			>.clear {
				margin-bottom: 20px;
				&:last-child{
					margin-bottom: 0;
				}
			}
			.form-item {
				margin-bottom: 0px;
				float: left;
				.form-item-title {
					width: 100px;
				}
				.form-item-content {
					width: 180px;
					.template-download{
						text-decoration: underline;
						color: #409EFF;
					}
					.el-radio-button {
						margin-right: 10px;
						&:last-child{
							margin-bottom: 0;
						}
					}
					.el-radio-button__inner {
						border: 1px solid #EEEEEE;
						box-shadow: none;
						color: #333;
						border-radius: 2px;
						font-size: 14px;
						min-width: 60px;
						padding: 0 15px;
						height: 32px;
						line-height: 30px;
					}
					.el-radio-button__orig-radio:checked+.el-radio-button__inner {
						color: #FFF;
						background-color: #409EFF;
						border-color: #409EFF;
					}
					.invalid-item{
						max-width: 370px;
						background: #FFFFFF;
						border: 1px solid #eee;
						line-height: 24px;
						padding: 3px 12px;
						text-align: left;
						cursor: pointer;
						float: left;
						margin-right: 10px;
						margin-bottom: 14px;
						&:last-child{
							margin-bottom: 0;
						}
					}
					.selected-invalid{
						border-color: #409EFF;
						color: #409EFF;
					}
					.el-icon-upload {
                        margin-right: 2px;
                    }
				}
			}
		}
	}
</style>